

class DBConCf:

    def __init__(self):
        self.test = ('192.168.80.155', 'caoqing', 'caoqing', 'dcr_web',)
        self.prod = {
            'collect_server': ('172.17.156.76', 'jinjing', 'jinjing', 'dcr_web',),
            'clean_server': ('172.17.156.77', 'jinjing', 'jinjing', 'dcv_web_c'),
            'web_server': ('172.17.163.145', 'jinjing', 'jinjing', 'app_info'),
            'log_server': ('172.17.156.75', 'jinjing', 'jinjing', 'dc_log')
        }
    def __call__(self,env, server_type=None):
        env_config = getattr(self, env, None)
        
        if env_config is None:
            raise ValueError("Invalid environment. Choose 'test' or 'prod'.")
        
        if env == 'prod':
            if server_type is None:
                raise ValueError("Server type must be provided for 'prod' environment")
            return env_config.get(server_type, "Server type not found in 'prod' configuration")
        
        return env_config